/**
 * @author zowie
 * @dete 2022-
 * @function 
 * @param {} 
 * @return {} 
 */


function longest(s1, s2) {
  // var s=(s1.concat(s2)).split('')
  // s.sort(function(a,b){return a-b});
  // console.log(s)


  return [].filter.call(((((s1.concat(s2))).split('')).sort()), (s, i, o) => o.indexOf(s) == i).join('')
}


console.log(longest("aretheyhere", "yestheyarehere"))
